<%@page import="com.wanmait.travel.vo.Comment"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%String path=request.getServletContext().getContextPath(); %>
<%
		List<Comment> comments = (List<Comment>)request.getAttribute("comments");
	
		for(int i=0;comments!=null&&i<comments.size();i++){
			Comment comment = comments.get(i);
			%>
			<li id="li<%=comment.getUserinfo().getId()%>">
				<div class="userinfo">
					<span><%=comment.getUserinfo().getNickname() %></span>
				
				</div>
				<div class="time"><%=comment.getCommmentDate() %></div>
				<div class="info">
					<%=comment.getComment() %>
				</div>
			    <input type="button"  value="删除"  id="delete" onclick="deleted(this)" data-id="<%=comment.getUserinfo().getId()%>" style="width:50px;"> 
			</li>
			<%
		}
		%>
		
		<script>
		function deleted(me)
		{
			var action="/Travel/CommentController?action=deleted";
			var userinfoid=$(me).data("id");
			/* $.ajax({
				url:action,//ajax访问路径
				data:{id:userinfoid},//参数
				async:false,//是否同步
				type:"post",//访问方式get，post
				success:function(mes){
					$("#li"+userinfoid).remove();
				}
			}) */
			 $.post(action,{id:userinfoid},function(mes){
				 $("#li"+userinfoid).remove();
					});
			 
		}
	
		
		</script>